package com.jskj.actions;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;

import com.jskj.commons.BaseAction;

public class MenuAction extends BaseAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String _dc;
	private String node;

	
	public String get_dc() {
		return _dc;
	}


	public void set_dc(String _dc) {
		this._dc = _dc;
	}


	public String getNode() {
		return node;
	}


	public void setNode(String node) {
		this.node = node;
	}


	public void getMenu() {
	        HttpServletRequest request=ServletActionContext.getRequest();
                HttpSession session=request.getSession();
                String strJson="";
                if (session.getAttribute("isadmin").equals("1")) {
                        strJson="["+
                                        "{"+
                                        "\"id\":\"2\""+
                                        ",\"text\":\"数据查询\""+
                                        ",\"children\":[{"+
                                                        "\"id\":\"21\""+
                                                        ",\"text\":\"中心站报表\""+
                                                        ",\"url\":\"sjcx/zxzbb.jsp\""+
                                                        ",\"leaf\":\"true\""+
                                                "},{" +
                                                        "\"id\":\"22\""+
                                                        ",\"text\":\"普通站报表\""+
                                                        ",\"url\":\"sjcx/ptzbb.jsp\""+
                                                        ",\"leaf\":\"true\""+
                                                "}]"+
                                        "},{"+
                                        "\"id\":\"3\""+
                                        ",\"text\":\"数据统计\""+
                                        ",\"children\":[{"+
                                                        "\"id\":\"31\""+
                                                        ",\"text\":\"各区县局数据统计\""+
                                                        ",\"url\":\"sjhz/qxjhzb.jsp\""+
                                                        ",\"leaf\":\"true\""+
                                                "},{" +
                                                        "\"id\":\"32\""+
                                                        ",\"text\":\"各中心加油站数据统计\""+
                                                        ",\"url\":\"sjhz/zxzhzb.jsp\""+
                                                        ",\"leaf\":\"true\""+
                                                "},{" +
                                                        "\"id\":\"33\""+
                                                        ",\"text\":\"各普通加油站数据统计\""+
                                                        ",\"url\":\"sjhz/ptzhzb.jsp\""+
                                                        ",\"leaf\":\"true\""+
                                                "},{" +
                                                        "\"id\":\"34\""+
                                                        ",\"text\":\"普通加油站明细数据\""+
                                                        ",\"url\":\"sjhz/ptzmxb.jsp\""+
                                                        ",\"leaf\":\"true\""+
                                                "}]"+
                                        "},{"+
                                        "\"id\":\"4\""+
                                        ",\"text\":\"加油站信息管理\""+
                                        ",\"children\":[{"+
                                                        "\"id\":\"41\""+
                                                        ",\"text\":\"中心站信息管理\""+
                                                        ",\"url\":\"jyzgl/jyzxx.jsp\""+
                                                        ",\"leaf\":\"true\""+
                                                "},{"+
                                                        "\"id\":\"42\""+
                                                        ",\"text\":\"中心站关联管理\""+
                                                        ",\"url\":\"jyzgl/jyzgx.jsp\""+
                                                        ",\"leaf\":\"true\""+
                                                "},{"+
                                                        "\"id\":\"43\""+
                                                        ",\"text\":\"油品信息管理\""+
                                                        ",\"url\":\"jyzgl/ypxx.jsp\""+
                                                        ",\"leaf\":\"true\""+
                                                "}]"+
                                        "},{"+
                                        "\"id\":\"5\""+
                                        ",\"text\":\"用户管理\""+
                                        ",\"children\":[{"+
                                                        "\"id\":\"51\""+
                                                        ",\"text\":\"人员管理\""+
                                                        ",\"url\":\"xtgl/rygl.jsp\""+
                                                        ",\"leaf\":\"true\""+
                                                "}]"+
                                        "}"+
                                        "]";
                }else{
                        strJson="["+
                                        "{"+
                                        "\"id\":\"2\""+
                                        ",\"text\":\"数据查询\""+
                                        ",\"children\":[{"+
                                                        "\"id\":\"21\""+
                                                        ",\"text\":\"中心站报表\""+
                                                        ",\"url\":\"sjcx/zxzbb.jsp\""+
                                                        ",\"leaf\":\"true\""+
                                                "},{" +
                                                        "\"id\":\"22\""+
                                                        ",\"text\":\"普通站报表\""+
                                                        ",\"url\":\"sjcx/ptzbb.jsp\""+
                                                        ",\"leaf\":\"true\""+
                                                "}]"+
                                        "},{"+
                                        "\"id\":\"3\""+
                                        ",\"text\":\"数据统计\""+
                                        ",\"children\":[{"+
                                                        "\"id\":\"31\""+
                                                        ",\"text\":\"各区县局数据统计\""+
                                                        ",\"url\":\"sjhz/qxjhzb.jsp\""+
                                                        ",\"leaf\":\"true\""+
                                                "},{" +
                                                        "\"id\":\"32\""+
                                                        ",\"text\":\"各中心加油站数据统计\""+
                                                        ",\"url\":\"sjhz/zxzhzb.jsp\""+
                                                        ",\"leaf\":\"true\""+
                                                "},{" +
                                                        "\"id\":\"33\""+
                                                        ",\"text\":\"各普通加油站数据统计\""+
                                                        ",\"url\":\"sjhz/ptzhzb.jsp\""+
                                                        ",\"leaf\":\"true\""+
                                                "},{" +
                                                        "\"id\":\"34\""+
                                                        ",\"text\":\"普通加油站明细数据\""+
                                                        ",\"url\":\"sjhz/ptzmxb.jsp\""+
                                                        ",\"leaf\":\"true\""+
                                                "}]"+
                                        "}"+
                                        "]";
                }
		this.out(strJson);
		
	}
}
